Read Me

This is an interactive dashboard set up to visualize the Baseline GCAM model results for the five different soil carbon scenarios (FAO Glosis (Series 84), Houghton (Series 85), Harmonized World Soils Database (Series 86), Soil Grids 2017 (Series 87), and Soil Grids 2020(Series 89)).

There are 5 tabs, this initial Read Me, and the Baseline Scenarios, which have the actual numbers associated with each of the simulations)

The Net and cumulative Emissions, Soil Emission Plots, Vegetative Plots, and Land Use Plots show the different value of the corn and soy shocks in relative to the baseline scenarios.

The initialization parameters for each model are listed below.

Each plot is clickable, and lines can be toggled on and off, zoomed in on, and panned.

Row

Initial Parameters

Future Baseline Scenarios

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters:

Unmanaged Pasture - Cropland.

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row

Baseline Land Use Change

Baseline Soil and Vegetative Emissions

Row

Net Baseline Emissions

Net Cumulative Baseline Emissions

Net and Cumulative Emissions

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters:

Unmanaged Pasture - Cropland.

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row

Total Net Corn Shock Emissions Over Baseline

Total Net Soy Shock Emissions Over Baseline

Row

Total Cumulative Net Corn Shock Emissions Over Baseline

Total Cumulative Net Soy Shock Emissions Over Baseline

Soil Emission Plots

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters:

Unmanaged Pasture - Cropland.

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row

Total Corn Shock Emissions Over Baseline

Total Soy Shock Emissions Over Baseline

Row

Soil Cumulative Corn Shock Emissions Over Baseline

Soil Cumulative Soy Shock Emissions Over Baseline

Vegetative Plots

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters:

Unmanaged Pasture - Cropland.

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row

Corn Shock Vegetative Emission Change Over Baseline by Land Use Type

Soy Shock Vegetative Change Over Baseline by Land Use Type

Row

Cumulative Corn Shock Vegetative Emission Change Over Baseline by Land Use Type

Cumulative Soy Shock Vegetative Change Over Baseline by Land Use Type

Land Use Plots

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters:

Unmanaged Pasture - Cropland.

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row

Corn Shock Land Use Change Over Baseline by Land Use Type

Soy Shock Land Use Change Over Baseline by Land Use Type

Row

Cumulative Corn Shock Land Use Change Over Baseline by Land Use Type

Cumulative Soy Shock Land Use Change Over Baseline by Land Use Type

---
title: "Missouri Basin Corn and Soy Shocks"
author: "Mandy Liesch"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
library(ggplot2)
library(plotly)
library(knitr)
library(plyr)
library(flexdashboard)
library(tidyverse)
library(ggnewscale)
library(cowplot)

landUse<-read_csv("LandUse_Shocks.csv")

vegShocks<-read_csv("Vegetative_Shocks.csv")

LUColors <- c("UrbanLand"="#C80813FF", "Urban"="#C80813FF", "Tundra"="#71D0F5FF", 
              "Rock/Ice/Desert"="#8A9197FF", "Cropland" = "#FED439FF",
              "HarvCropLand"="#FED439FF", "Harvested Cropland"="#FED439FF", 
              "OtherArableLand" = "#D2AF81FF", "Other Arable Land" = "#D2AF81FF",
              "Pasture"= "#FD8CC1FF", "UnmanagedPasture"="#370335FF", 
              "Unmanaged Pasture"="#370335FF",
              "Grassland" = "#46732EFF", "Forest" = "#075149FF", 
              "Shrubland" = "#F05C3BFF", "otherNotArable"="#8A9197FF")

# Vegetative Based Color Pallet
vegCEmissions<-c("#46732EFF")

ModelColors<- c("FAO"="#370335FF", "Houghton" = "#FED439FF", 
                "GCAM" = "#FED439FF", "HWSD"="#1A9993FF", "SG17" = "#197EC0FF",
                "SG20"="#F05C3BFF")

#Break up the land leaf columns into subsets 
#(each land leaf has 4 different categories)
new_LU<-landUse %>% 
  separate(LandLeaf, c("LandUse", "Basin", "Water", "Input")) %>%
  separate(scenario, into = c('scenario', 'date'), sep = ",") %>%
  select(-c("date", "Basin", "Units"))


#Sum together all of the land leaf files by land use type
sum_new_LU<- new_LU %>% 
  group_by(scenario, LandUse) %>% 
  summarise(across(where(is.numeric), sum))

#Reclassify land use types into broader categories
cat_LU<-sum_new_LU %>% 
  mutate(Category = case_when(
  #Cropland category  
  LandUse %in% 
    #Biomass Crops
    c("biomassGrass", "biomassTree",  
    #Fodder Crops
      "FodderGrass", "FodderHerb", 
    #Grain Crops
      "Corn",  "Soybean", "Wheat", "OtherGrain",
    #Oil Crops
      "OilCrop", "Rapeseed", 
    #Other Crops
      "FiberCrop", "MiscCrop", "RootTuber",  "SugarCrop") 
    #Land Use Name
      ~ "HarvCropLand",
    #Other Arable Land
    LandUse == "OtherArableLand" ~"OtherArableLand",
    #Forest categories
    LandUse %in% c("Forest", "UnmanagedForest", "ProtectedUnmanagedForest")
                ~ "Forest",
    #Grassland categories
    LandUse %in% c("Grassland", "ProtectedGrassland") ~ "Grassland", 
    #Pasture category
    LandUse=="Pasture" ~ "Pasture",
    #Unamanged pasture category
    LandUse %in% c("ProtectedUnmanagedPasture", "UnmanagedPasture") 
              ~ "UnmanagedPasture",
    #Shrubland category
    LandUse %in% c("Shrubland", "ProtectedShrubland") ~ "Shrubland",
    #Other categories
    LandUse=="Tundra" ~ "Tundra",
    LandUse=="UrbanLand" ~ "UrbanLand",
    #Default Return Statement
    TRUE~NA_character_
  )
)

#Sum everything up by defined land use category
sum_cat_LU<-cat_LU %>% 
  group_by(scenario, Category) %>% 
  summarise(across(where(is.numeric), sum))

#Create a long dataframe with land use, years, and area 
wide_sum_LU<-sum_cat_LU %>% 
  pivot_longer(!c(scenario, Category), names_to=c("year"), values_to = "area") %>%
  #convert years into the numeric values
  mutate(year = as.numeric(year)) %>% 
  pivot_wider(names_from = scenario, values_from = c(area)) %>%
  mutate(DifCornShock = CORN1BG - BASE) %>%
  mutate(DifSoyShock = SOY1BG - BASE) %>%
  group_by(Category) %>%
  mutate(CumSumCornLand = cumsum(DifCornShock)) %>%
  mutate(CumSumSoyLand = cumsum(DifSoyShock)) %>%
     mutate(Category = recode(Category, HarvCropLand = "Harvested Cropland",
         OtherArableLand = "Other Arable Land",
         UnmanagedPasture = "Unmanaged Pasture", 
         UrbanLand = "Urban"
     )
)
  
#Break up the land leaf columns into subsets 
#(each land leaf has 4 different categories)
new_veg<-vegShocks %>% 
  separate(LandLeaf, c("LandUse", "Basin", "Water", "Input")) %>%
  separate(scenario, into = c('scenario', 'date'), sep = ",") %>%
  select(-c("date", "Basin", "Units"))


#Sum together all of the land leaf files by land use type
sum_new_veg<- new_veg %>% 
  group_by(scenario, LandUse) %>% 
  summarise(across(where(is.numeric), sum))

#Reclassify land use types into broader categories
cat_veg<-sum_new_veg %>% 
  mutate(Category = case_when(
  #Cropland category  
  LandUse %in% 
    #Biomass Crops
    c("biomassGrass", "biomassTree",  
    #Fodder Crops
      "FodderGrass", "FodderHerb", 
    #Grain Crops
      "Corn",  "Soybean", "Wheat", "OtherGrain",
    #Oil Crops
      "OilCrop", "Rapeseed", 
    #Other Crops
      "FiberCrop", "MiscCrop", "RootTuber",  "SugarCrop") 
    #Land Use Name
      ~ "HarvCropLand",
    #Other Arable Land
    LandUse == "OtherArableLand" ~"OtherArableLand",
    #Forest categories
    LandUse %in% c("Forest", "UnmanagedForest", "ProtectedUnmanagedForest")
                ~ "Forest",
    #Grassland categories
    LandUse %in% c("Grassland", "ProtectedGrassland") ~ "Grassland", 
    #Pasture category
    LandUse=="Pasture" ~ "Pasture",
    #Unamanged pasture category
    LandUse %in% c("ProtectedUnmanagedPasture", "UnmanagedPasture") 
              ~ "UnmanagedPasture",
    #Shrubland category
    LandUse %in% c("Shrubland", "ProtectedShrubland") ~ "Shrubland",
    #Other categories
    LandUse=="Tundra" ~ "Tundra",
    LandUse=="UrbanLand" ~ "UrbanLand",
    #Default Return Statement
    TRUE~NA_character_
  )
)

#Sum everything up by defined land use category
sum_cat_veg<-cat_veg %>% 
  group_by(scenario, Category) %>% 
  summarise(across(where(is.numeric), sum)) %>%
  select(scenario:'2060')


#Create a long dataframe with land use, years, and area 
wide_sum_veg<-sum_cat_veg  %>% 
  pivot_longer(!c(scenario, Category), names_to=c("year"), values_to = "area") %>%
  #convert years into the numeric values
  mutate(year = as.numeric(year)) %>% 
  pivot_wider(names_from = scenario, values_from = c(area)) %>%
  mutate(DifCornShock = CORN1BG - BASE) %>%
  mutate(DifSoyShock = SOY1BG - BASE) %>%
  group_by(Category) %>%
  mutate(cumSumCornVeg= cumsum(DifCornShock))%>%
  mutate(cumSumSoyVeg= cumsum(DifSoyShock)) %>%
     mutate(Category = recode(Category, HarvCropLand = "Harvested Cropland",
         OtherArableLand = "Other Arable Land",
         UnmanagedPasture = "Unmanaged Pasture", 
         UrbanLand = "Urban"
     )
)


#Create a series loop to read in all of the data

#Create a list of all .csv files in the output folder
files <- list.files(path="~/github/GCAMShocks/GCAM_Shocks/Shocks", pattern = "\\values.csv$", 
                    full.names = TRUE)

#Initialize an empty list to store data frames
data_list <- list()

# Loop over each file and read it into a data frame
for (file in files) {
  data <- read.csv(file)
  data_list[[file]] <- data
}

# Combine all data frames into one
combined_shock_soil_data <- bind_rows(data_list)

new_Soil_Shock_Emiss<- combined_shock_soil_data %>% 
  separate(LandLeaf, c("LandUse", "Basin", "Water", "Input")) %>%
  separate(scenario, into = c('scenario', 'date'), sep = ",") %>%
  select(-c("date", "region", "Basin", "Units"))  %>%
  select(Series:'X2060')

#Sum together all of the land leaf files by land use type
sum_new_Soil_Emiss<- new_Soil_Shock_Emiss %>% 
  group_by(Series, scenario, LandUse) %>% 
  summarise(across(where(is.numeric), sum))

#Reclassify land use types into broader categories
cat_Soil_Emiss<-sum_new_Soil_Emiss %>% 
  mutate(Category = case_when(
  #Cropland category  
  LandUse %in% 
    #Biomass Crops
    c("biomassGrass", "biomassTree",  
    #Fodder Crops
      "FodderGrass", "FodderHerb", 
    #Grain Crops
      "Corn",  "Soybean", "Wheat", "OtherGrain",
    #Oil Crops
      "OilCrop", "Rapeseed", 
    #Other Crops
      "FiberCrop", "MiscCrop", "RootTuber",  "SugarCrop") 
    #Land Use Name
      ~ "HarvCropLand",
    #Other Arable Land
    LandUse == "OtherArableLand" ~"OtherArableLand",
    #Forest categories
    LandUse %in% c("Forest", "UnmanagedForest", "ProtectedUnmanagedForest")
                ~ "Forest",
    #Grassland categories
    LandUse %in% c("Grassland", "ProtectedGrassland") ~ "Grassland", 
    #Pasture category
    LandUse=="Pasture" ~ "Pasture",
    #Unamanged pasture category
    LandUse %in% c("ProtectedUnmanagedPasture", "UnmanagedPasture") 
              ~ "UnmanagedPasture",
    #Shrubland category
    LandUse %in% c("Shrubland", "ProtectedShrubland") ~ "Shrubland",
    #Other categories
    LandUse=="Tundra" ~ "Tundra",
    LandUse=="UrbanLand" ~ "UrbanLand",
    #Default Return Statement
    TRUE~NA_character_
  )
)

#Sum everything up by defined land use category
sum_cat_soil_emiss<- cat_Soil_Emiss %>% 
  group_by(Series, scenario, Category) %>% 
  summarise(across(where(is.numeric), sum))

#Create a long dataframe with land use, years, and area 
wide_sum_soil_emiss<- sum_cat_soil_emiss %>% 
  pivot_longer(!c(Series, scenario, Category), names_to=c("year"), values_to = "area") %>%
  #Remove the extra X value from the dataset
  mutate(across(c('year'), substr, 2, nchar(year))) %>%
  #convert years into the numeric values
  mutate(year = as.numeric(year)) %>% 
  pivot_wider(names_from = scenario, values_from = c(area)) %>%
  mutate(DifCornShock = CORN1BG - BASE) %>%
  mutate(DifSoyShock = SOY1BG - BASE)  %>%
     mutate(Category = recode(Category, HarvCropLand = "Harvested Cropland",
         OtherArableLand = "Other Arable Land",
         UnmanagedPasture = "Unmanaged Pasture", 
         UrbanLand = "Urban"
     ) 
) %>%
  mutate(Series = recode(Series, GCAM = "Houghton"))

cum_soil_emiss_sums<-wide_sum_soil_emiss %>%
   group_by(Series, year) %>% 
  summarise(across(where(is.numeric), sum)) %>%
#calculate the cumulative emissions
  mutate(aggDifCorncount = cumsum(DifCornShock)) %>%
  mutate(aggDifSoycount = cumsum(DifSoyShock))


mergedData<-merge(wide_sum_soil_emiss, wide_sum_veg, 
                  by=c("Category", "year"), all=TRUE) %>%
#rename all of the columns after the merge
               rename( c( "BASE.soil" ="BASE.x", 
                           "BASE.veg" = "BASE.y", 
                           "CORN1BG.soil" =  "CORN1BG.x", 
                           "CORN1BG.veg" = "CORN1BG.y",
                          "SOY1BG.soil" =  "SOY1BG.x", 
                           "SOY1BG.veg" = "SOY1BG.y",
                          "DifCornShock.soil" = "DifCornShock.x", 
                          "DifSoyShock.soil" = "DifSoyShock.x", 
                           "DifCornShock.veg" = "DifCornShock.y", 
                          "DifSoyShock.veg" = "DifSoyShock.y" )) %>%
                mutate(netDifCornShock = DifCornShock.soil + DifCornShock.veg) %>%
                mutate(netDifSoyShock = DifSoyShock.soil + DifSoyShock.veg)

sum_merged_data <- mergedData %>%
   group_by(Series, year) %>% 
  dplyr::summarise(across(where(is.numeric), sum)) %>%
  group_by(Series) %>%
  dplyr::mutate(aggNetSumDifCorncount = cumsum(netDifCornShock)) %>%
  dplyr::mutate(aggNetSumDifSoycount = cumsum(netDifSoyShock)) %>%
  dplyr::mutate(BASENetEmiss = BASE.soil + BASE.veg) %>%
  group_by(Series) %>%
  filter(year >2015) %>%
  dplyr::mutate(BASECumNetEmiss = cumsum(BASENetEmiss)) %>%
  mutate(Series = recode(Series, GCAM = "Houghton"))

```

Read Me
=======================================================================

This is an interactive dashboard set up to visualize the Baseline GCAM model results for the five different soil carbon scenarios (FAO Glosis (Series 84), Houghton (Series 85), Harmonized World Soils Database (Series 86), Soil Grids 2017 (Series 87), and Soil Grids 2020(Series 89)). 

There are 5 tabs, this initial Read Me, and the Baseline Scenarios, which have the actual numbers associated with each of the simulations) 

The Net and cumulative Emissions, Soil Emission Plots, Vegetative Plots, and Land Use Plots show the different value of the corn and soy shocks in relative to the baseline scenarios. 

The initialization parameters for each model are listed below. 

Each plot is clickable, and lines can be toggled on and off, zoomed in on, and panned. 

Row
-----------------------------------------------------------------------
### Initial Parameters

```{r}
include_graphics("InitialTable.jpg") 
```

Future Baseline Scenarios
=======================================================================
Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters: 

Unmanaged Pasture - Cropland. 

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2


Row
-----------------------------------------------------------------------
### Baseline Land Use Change

```{r}
LandUseAreaFuture.plt<- ggplot(wide_sum_LU %>%
                                 filter(year >=2015), 
                               aes(x=year, y=BASE, color=Category)) + 
    geom_line(size=2) +
  #Set the legend to be on the bottom
  theme(legend.position = "bottom")+
  #Add a title
  #ggtitle("A)Historic and Projected Land Use") +
  #add the labels
  labs(fill = "Land Use (Mha)", x='Year', y='Mha') + 
  #set the legend to be on one line
  #guides(fill = guide_legend(nrow = 1)) +
  #Use the custom designed color pallette and set names and labels
  scale_color_manual(values=LUColors)

ggplotly(LandUseAreaFuture.plt)



```

### Baseline Soil and Vegetative Emissions
```{r}
#Calculate the future emissions plots
futureEmissions.plt<-ggplot(data=sum_merged_data %>%
                              filter(year >2015), aes(x=year))+
  #Add a line plot for the soil emissions by series
  geom_line(aes(y=BASE.soil,
       group=Series, color=Series), lwd=2) +
      #Add the custom color manual and labels
      scale_color_manual(values=c(ModelColors)) +

  #Add a line plot for the vegetative emissions
  geom_line(aes(y=BASE.veg, color="Vegetation"), lwd=2) +

  #Add the title
  #ggtitle("Future Emissions") +
  #Add the theme elements
  #theme(plot.title = element_text(hjust = 0.5)) +
  #Add the labels
  labs( x='Year', y='Total Emissions (Mt)') 

ggplotly(futureEmissions.plt)

```

Row
-----------------------------------------------------------------------
### Net Baseline Emissions
```{r}
#Calculate the net emissions plots by series
futNetEmissions.plt<-ggplot(data=sum_merged_data %>%
                              filter(year >2015), 
                            aes(x=year, y=BASENetEmiss, group=Series))+
  geom_line(aes(color=Series), lwd=2) +
      #Add the custom color manual and labels
      scale_color_manual(values=c(ModelColors, name = "Emissions"), 
                      labels = c("FAO Glosis", "Houghton", "HWSD", 
                                 "SoilGrids 2017", "SoilGrids 2020")) +
  #Add the title
  #ggtitle("Future Net Emissions") +
  #Add the theme elements
  #theme(plot.title = element_text(hjust = 0.5)) +
  #Add the labels
  labs( x='Year', y='Total Emissions (Mt)') 
  
ggplotly(futNetEmissions.plt)
```

### Net Cumulative Baseline Emissions
``` {r}
futCumNetEmissions.plt<-ggplot(data=sum_merged_data %>%
                              filter(year >2015), 
                            aes(x=year, y=BASECumNetEmiss, group=Series))+
  geom_line(aes(color=Series), lwd=2) +
      #Add the custom color manual and labels
      scale_color_manual(values=c(ModelColors, name = "Emissions"), 
                      labels = c("FAO Glosis", "Houghton", "HWSD", 
                                 "SoilGrids 2017", "SoilGrids 2020")) +
  #Add the title
  #ggtitle("Future Net Emissions") +
  #Add the theme elements
  #theme(plot.title = element_text(hjust = 0.5)) +
  #Add the labels
  labs( x='Year', y='Total Emissions (Mt)') 
  
ggplotly(futCumNetEmissions.plt)

```



Net and Cumulative Emissions 
=======================================================================

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters: 

Unmanaged Pasture - Cropland. 

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row
-----------------------------------------------------------------------
### Total Net Corn Shock Emissions Over Baseline

```{r}



net_emiss_CS_Models.plt<-ggplot(data= sum_merged_data %>%
                                    filter(year > 2015), 
                         aes(x=year, y=netDifCornShock, group=Series, color=Series))+
  geom_line(aes(), size=2) +
  #add a title
  #ggtitle("Total Net Corn Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)

ggplotly(net_emiss_CS_Models.plt)
```

### Total Net Soy Shock Emissions Over Baseline
```{r}
net_emiss_SS_Models.plt<-ggplot(data= sum_merged_data %>%
                                    filter(year > 2015), 
                         aes(x=year, y=netDifSoyShock, group=Series, color=Series))+
  geom_line(aes(), size=2) +
  #add a title
  #ggtitle("Total Net Soy Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)

ggplotly(net_emiss_SS_Models.plt)
```

Row
-----------------------------------------------------------------------
### Total Cumulative Net Corn Shock Emissions Over Baseline

```{r}
cum_net_emiss_CS_Models.plt<-ggplot(data= sum_merged_data %>%
                                    filter(year > 2015),
                         aes(x=year, y=aggNetSumDifCorncount, group=Series, color=Series))+
  geom_line(aes(), size=2) +
  #add a title
  #ggtitle("Total Cumulative Net Corn Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)

ggplotly(cum_net_emiss_CS_Models.plt)
```

### Total Cumulative Net Soy Shock Emissions Over Baseline

```{r}
cum_net_emiss_SS_Models.plt<-ggplot(data= sum_merged_data %>%
                                    filter(year > 2015),
                         aes(x=year, y=aggNetSumDifSoycount, group=Series, color=Series))+
  geom_line(aes(), size=2) +
  #add a title
  #ggtitle("Total Cumulative Net soy Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)

ggplotly(cum_net_emiss_SS_Models.plt)
```

Soil Emission Plots
=======================================================================

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters: 

Unmanaged Pasture - Cropland. 

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row
-----------------------------------------------------------------------

### Total Corn Shock Emissions Over Baseline

```{r}

  
cum_soil_emiss_sums_CS_Models.plt<-ggplot(data= cum_soil_emiss_sums %>%
                                    filter(year > 2015), 
                         aes(x=year, y=DifCornShock, group=Series))+
  geom_line(aes(color=Series), size=2) +
  #add a title
  #ggtitle("Total Corn Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)
# Use hollow circles
ggplotly(cum_soil_emiss_sums_CS_Models.plt)
```


### Total Soy Shock Emissions Over Baseline

```{r}
cum_soil_emiss_sums_SS_Models.plt<-ggplot(data= cum_soil_emiss_sums %>%
                                    filter(year > 2015), 
                         aes(x=year, y=DifSoyShock, group=Series))+
  geom_line(aes(color=Series), size=2) +
  #add a title
  #ggtitle("Total Soy Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)



ggplotly(cum_soil_emiss_sums_SS_Models.plt)
```

Row
-----------------------------------------------------------------------

### Soil Cumulative Corn Shock Emissions Over Baseline

```{r}
tot_cum_soil_emiss_sums_CS_Models.plt<-ggplot(data= cum_soil_emiss_sums %>%
                                    filter(year > 2015), 
                         aes(x=year, y=aggDifCorncount, group=Series))+
  geom_line(aes(color=Series), size=2) +
  #add a title
  #ggtitle("Soil Cumulative Corn Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)



# Add a loess smoothed fit curve with confidence region
ggplotly(tot_cum_soil_emiss_sums_CS_Models.plt)
```

### Soil Cumulative Soy Shock Emissions Over Baseline

```{r}
tot_cum_soil_emiss_sums_SS_Models.plt<-ggplot(data= cum_soil_emiss_sums %>%
                                    filter(year > 2015), 
                         aes(x=year, y=aggDifSoycount, group=Series))+
  geom_line(aes(color=Series), size=2) +
  #add a title
  #ggtitle("Soil Cumulative Soy Shock Emissions Over Baseline") +
  #add labels
  labs( x='Year', y='Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=ModelColors)


ggplotly(tot_cum_soil_emiss_sums_SS_Models.plt)
```

Vegetative Plots
=======================================================================

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters: 

Unmanaged Pasture - Cropland. 

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row
-----------------------------------------------------------------------

### Corn Shock Vegetative Emission Change Over Baseline by Land Use Type

```{r}

#Create a spaghetti plot of land use area using area by category
CornShockVegLines.plt<-ggplot(data= wide_sum_veg %>%
                                    filter(year >2015), 
                         aes(x=year, y=DifCornShock, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Corn Shock Vegetative Emission Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Vegetative Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(CornShockVegLines.plt)
```



### Soy Shock Vegetative Change Over Baseline by Land Use Type

```{r}
#Create a spaghetti plot of land use area using area by category
SoyShockVegUseLines.plt<-ggplot(data= wide_sum_veg %>%
                                    filter(year >2015), 
                         aes(x=year, y=DifSoyShock, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Soy Shock Vegetative Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Vegetative Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(SoyShockVegUseLines.plt)

```

Row
-----------------------------------------------------------------------
### Cumulative Corn Shock Vegetative Emission Change Over Baseline by Land Use Type

```{r}
#Create a spaghetti plot of land use area using area by category
cumCornShockVegLines.plt<-ggplot(data= wide_sum_veg %>%
                                    filter(year >2015), 
                         aes(x=year, y=cumSumCornVeg, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Corn Shock Vegetative Emission Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Vegetative Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(cumCornShockVegLines.plt)                        
```

### Cumulative Soy Shock Vegetative Change Over Baseline by Land Use Type

```{r}


#Create a spaghetti plot of land use area using area by category
cumSoyShockVegUseLines.plt<-ggplot(data= wide_sum_veg %>%
                                    filter(year >2015), 
                         aes(x=year, y=cumSumSoyVeg, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Soy Shock Vegetative Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Vegetative Emissions (Mt)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(cumSoyShockVegUseLines.plt)
```




Land Use Plots
=======================================================================

Since the biggest land use change in these timesteps involve the transition from unmanaged pasture to cropland, I am taking the difference of the initial parameters: 

Unmanaged Pasture - Cropland. 

FAO GLOSIS: -3.15 kg/m^2, Houghton: 1.39 kg/m^2, HWSD: -1.55 kg/m^2, SG17: -1.18 kg/m^2, SG20: -1.77 kg/m^2

Row
-----------------------------------------------------------------------

### Corn Shock Land Use Change Over Baseline by Land Use Type

```{r}
#Create a spaghetti plot of land use area using area by category
CornShockLandUseLines.plt<-ggplot(data= wide_sum_LU %>%
                                    filter(year >2015), 
                         aes(x=year, y=DifCornShock, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Corn Shock Land Use Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Land Area (thous sq km)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(CornShockLandUseLines.plt)

```

### Soy Shock Land Use Change Over Baseline by Land Use Type

```{r}
#Create a spaghetti plot of land use area using area by category
SoyShockLandUseLines.plt<-ggplot(data= wide_sum_LU %>%
                                    filter(year >2015), 
                         aes(x=year, y=DifSoyShock, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Soy Shock Land Use Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Land Area (thous sq km)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(SoyShockLandUseLines.plt)
```


Row
-----------------------------------------------------------------------

### Cumulative Corn Shock Land Use Change Over Baseline by Land Use Type

```{r}
#Create a spaghetti plot of land use area using area by category
CumCornShockLandUseLines.plt<-ggplot(data= wide_sum_LU %>%
                                    filter(year >2015), 
                         aes(x=year, y=CumSumCornLand, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Corn Shock Land Use Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Land Area (thous sq km)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(CumCornShockLandUseLines.plt)
```

### Cumulative Soy Shock Land Use Change Over Baseline by Land Use Type

```{r}
CumSoyShockLandUseLines.plt<-ggplot(data= wide_sum_LU %>%
                                    filter(year >2015), 
                         aes(x=year, y=CumSumSoyLand, group=Category))+
  geom_line(aes(color=Category), size=2) +
  #add a title
  #ggtitle("Corn Shock Land Use Change Over Baseline by Land Use Type") +
  #add labels
  labs( x='Year', y='Land Area (thous sq km)') +
  #use the custom color pallette
  scale_color_manual(values=LUColors, name = "Land Use", 
                     labels = c( "Forest", "Grassland", "Harvested Cropland", 
                                 "Other Arable Land", "Pasture", "Shrubland", 
                                 "Tundra", "Unmanaged Pasture", "Urban Land"))

ggplotly(CumSoyShockLandUseLines.plt)
```